﻿using System;
using System.Windows.Data;
using Thor.Common;

namespace Thor.Silverlight
{
    public class TimeValueConverter : IValueConverter
    {

        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && value is Time)
            {
                Time time = (Time)value;
                return time.Value;
            }
            else
                return null;
        }

        #endregion
    }
}
